<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo ($meta_title); ?>|绿叶收银台管理平台</title>
    <link href="/Public/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/module.css">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="/Public/Admin/css/<?php echo (C("COLOR_STYLE")); ?>.css" media="all">
	<!--<link rel="stylesheet" type="text/css" href="/Public/static/layui/layui/css/layui.css" media="all">-->
     <!--[if lt IE 9]>
    <script type="text/javascript" src="/Public/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="/Public/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/Public/static/layer/layer.js"></script>
    <!--<script type="text/javascript" src="/Public/static/layui/layui/layui.js"></script>-->
    <script type="text/javascript" src="/Public/Admin/js/jquery.mousewheel.js"></script>

    <!--<![endif]-->
    
    <style type="text/css">
.btn{

    background: #09c;
}
.btn:hover{
    background: #09c;
}
        .zaixian_shou{
            width: 33px;
            height: 33px;
            border-radius: 50% 50%;

        }
        .path2_status{
            width: 33px;
            height: 33px;
            border-radius: 50% 50%;

        }
        .frozen{
            width: 33px;
            height: 33px;
            border-radius: 50% 50%;

        }
        ._tixian{
            width: 33px;
            height: 33px;
            border-radius: 50% 50%;

        }
      .side-sub-menu > li > .item {
                color: #000;
                font-family: '宋体';
                font-size:15px;padding:0px;
                line-height: 25px;
            }
    .sidebar {
        background: #3697A0;
        position: absolute;
    }   

     /* 头部Logo,主导航*/
            body{
                color:#000;
                font-family: '宋体';
                font-weight: 900;
            }
            .header {
                background-color:   #3697A0;
                height: 45px;
            }
            /* 主导航 */
            .main-nav a {
                height: 45px;
                color: #150303;
            }
            .main-nav a:hover {
                height: 45px;
                background-color:#70bcf3;
                color: #150303;
            }
            .main-nav .current{
                height: 45px;
                background-color: #70bcf3;
            }
            .main-nav .current a {
                height: 45px;
                background-color: #70bcf3;
                color: #150303;
            }
            .logo{
                height: 45px;
                background: #ccc;
            }
            .sidebar{
                margin-top:-5px;
                background:     #3697A0;
                color: #000;
                position: fixed;
                height: 110%;
                margin-top:-40px;
            }
            .subnav h3{
                color: #000;
            }

            .main-nav {
                /*width:100%;*/
                float: none;
                height: auto;
            }

            .mainnav {
                /*height: auto;*/
                height: 100%;
            }

            .main-nav li{
                float: none;
                width:180px;
            }

                        /* Table Head */
.data-table thead th {
background-color: rgb(81, 130, 187);
color: #fff;
border-bottom-width: 0;
}

/* Column Style */
.data-table td {
color: #000;
}
/* Heading and Column Style */
.data-table tr, .data-table th {
border-width: 1px;
border-style: solid;
border-color: rgb(81, 130, 187);
}

/* Padding and font style */
.data-table td, .data-table th {
padding: 5px 10px;
font-size: 12px;
font-family: Verdana;
font-weight: bold;
}
    </style>

</head>
<body >
    <!-- 头部 -->
    <div class="header">
        <!-- Logo -->
        <!-- <span class="logo" style="/*background:url(/Public/Admin/images/bg_lf.png) no-repeat;*/"></span> -->
        <!-- /Logo -->

        <!-- 主导航 -->
        <!-- <ul class="main-nav" style="float:left">
            <?php if(is_array($__MENU__["main"])): $i = 0; $__LIST__ = $__MENU__["main"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li class="<?php echo ((isset($menu["class"]) && ($menu["class"] !== ""))?($menu["class"]):''); ?>" style="float:left"><a href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
        </ul> -->
        <!-- /主导航 -->

        <!-- 用户栏 -->
        <div class="user-bar">
            <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
            <ul class="nav-list user-menu hidden">
                <li class="manager">你好，<em title="<?php echo session('user_auth.username');?>"><?php echo session('user_auth.username');?></em></li>
                <li><a href="<?php echo U('User/updatePassword');?>">修改密码</a></li>
                <li><a href="<?php echo U('User/updateNickname');?>">修改昵称</a></li>
                <li><a href="<?php echo U('Public/logout');?>">退出</a></li>
            </ul>
        </div>
    </div>
    <!-- /头部 -->

    <!-- 边栏 -->
    <div class="sidebar" >
        <!-- 子导航 -->
        
            <ul class="main-nav" style="font-size:16px;">
                <?php if(is_array($__MENU__["main"])): $i = 0; $__LIST__ = $__MENU__["main"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li class="<?php echo ((isset($menu["class"]) && ($menu["class"] !== ""))?($menu["class"]):''); ?>"><a href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
            </ul>

            <div id="subnav" class="subnav" >
                <?php if(!empty($_extra_menu)): ?>
                    <?php echo extra_menu($_extra_menu,$__MENU__); endif; ?>
                <?php if(is_array($__MENU__["child"])): $i = 0; $__LIST__ = $__MENU__["child"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sub_menu): $mod = ($i % 2 );++$i;?><!-- 子导航 -->
                    <?php if(!empty($sub_menu)): if(!empty($key)): ?><h3><i class="icon"></i><?php echo ($key); ?></h3><?php endif; ?>
                        <ul class="side-sub-menu">
                            <?php if(is_array($sub_menu)): $i = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li>
                                    <a class="item" href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a>
                                </li><?php endforeach; endif; else: echo "" ;endif; ?>
                        </ul><?php endif; ?>
                    <!-- /子导航 --><?php endforeach; endif; else: echo "" ;endif; ?>
            </div>
        
        <!-- /子导航 -->
    </div>
    <!-- /边栏 -->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main" style="padding:20px;margin-top:-5px;margin-left: -20px;">
            
            <!-- nav -->
            <?php if(!empty($_show_nav)): ?><div class="breadcrumb">
                <span>您的位置:</span>
                <?php $i = '1'; ?>
                <?php if(is_array($_nav)): foreach($_nav as $k=>$v): if($i == count($_nav)): ?><span><?php echo ($v); ?></span>
                    <?php else: ?>
                    <span><a href="<?php echo ($k); ?>"><?php echo ($v); ?></a>&gt;</span><?php endif; ?>
                    <?php $i = $i+1; endforeach; endif; ?>
            </div><?php endif; ?>
            <!-- nav -->
            

            

<!-- 	<div class="main-title" style="margin-top:5px;">
		<h2>商户列表</h2>
	</div> -->
        <div class="cf" style="margin-top: 5px;margin-left:-50px;margin-bottom:10px;">
            <div style="float: left;padding-left: 50px;" class="">总人数：<span style="color: #ff6600"><?php echo ($usercount); ?></span>元</div>
            <div style="float: left;padding-left: 50px;" class="">总佣金：<span style="color: #ff6600"><?php echo ($sum["yongjin"]); ?></span>元</div>

            <div style="float: left;padding-left: 50px;" class="">总分润:<span style="color: #c43c35"><?php echo ($sum["divide"]); ?></span>元</div>
            <div style="float: left;padding-left: 50px;" class="">总交易量:<span style="color: #c43c35"><?php echo ($sum["t_money"]); ?></span>元</div>
            <div style="float: left;padding-left: 50px;" class="">今日进账：<span style="color: #0000ff"><?php echo ($sum["td_in"]); ?></span>元</div>
            <div style="float: left;padding-left: 50px;" class="">今日提现:<span style="color: #c43c35"><?php echo ($sum["td_out"]); ?></span>元</div>

        </div>
                <div class="cf">


                    <!--<div class="search-form fr cf">-->
                        <!--<div class="sleft">-->
                            <!--<div class="drop-down drop-down_type" style="width: 150px;">-->
                                <!--<span id="sch-sort-txt_type"  style="width: 115px;" class="sort-txt" data="">通道选择</span>-->
                                <!--<i class="arrow arrow-down"></i>-->
                                <!--<ul id="sub-sch-menu_type" class="nav-list hidden">-->
                                    <!--<li><a href="javascript:;" style="width: 115px;" value="1">信用卡</a></li>-->
                                    <!--<li><a href="javascript:;" style="width: 115px;" value="2">花呗</a></li>-->
                                    <!--<li><a href="javascript:;" style="width: 115px;" value="3">花呗分期</a></li>-->
                                    <!--<li><a href="javascript:;" style="width: 115px;" value="4">条码</a></li>-->
                                <!--</ul>-->
                            <!--</div>-->

                        <!--</div>-->

                        <!--<button class="btn kg" >开启</button>-->
                        <!--<button class="btn kg" >关闭</button>-->

                    <!--</div>-->


                    <!-- 高级搜索 -->
                    <div class="search-form fr cf">
                        <div class="sleft">
                            <input name="title" class="search-input" style="width:200px;" value="" placeholder="请输入名字、店名、商户编号" type="text">
                            <a class="sch-btn" href="javascript:;" id="search" url="<?php echo U('find_one');?>"><i class="btn-search"></i></a>
                        </div>

                    </div>

                    <button class="btn yh_delete" >删除用户</button>
                    <a class="btn" href="<?php echo U('add_user');?>" target="_blank">添加用户</a>
                    <button class="btn all_tixian">一键提现</button>
                </div>

	<div class="data-table table-striped" >
		<table style="font-size:14px;">
			<thead>
				<tr><th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                    <th>用户UID</th>
					<th>用户编号</th>
                    <th>姓名</th>
                    <th>手机号码</th>
                    <th>店铺名称</th>
                    <th>支付宝账号</th>
                    <!--<th>账户余额</th>-->
                    <th>交易量</th>
                    <th>在线收款状态</th>
                    <th>提现状态</th>
                    <th>上级/所属层级</th>
                    <th>未提现金额</th>
                    <th>提现</th>
                    <th>码商</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($_list)): if(is_array($_list)): $i = 0; $__LIST__ = $_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rows): $mod = ($i % 2 );++$i;?><tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="<?php echo ($rows['uid']); ?>" /></td>
                        <td class="uid"><?php echo ($rows['uid']); ?></td>
						<td><?php echo ($rows['yh_uid']); ?></td>
						
                        <td><?php echo ($rows['name']); ?></td>
                        <td><?php echo ($rows['phone']); ?></td>
                        <td><?php echo ($rows['shop_name']); ?></td>
                        <td><?php echo ($rows['alipay']); ?></td>
                        <?php $one=D('Gather')->where('uid='.$rows['uid'])->find(); ?>
                        <!--<td><?php echo ($one['money']); ?></td>-->
                        <?php $money1=D('Dingdan')->where('uid='.$rows['uid'])->sum('yh_money'); $money2=D('Xyk')->where('uid='.$rows['uid'])->sum('yh_money'); $money3=D('Wxpay')->where('uid='.$rows['uid'])->sum('yh_money'); $money4=D('Divided')->where('uid='.$rows['uid'])->sum('yh_money'); $money5=D('Youka')->where('uid='.$rows['uid'])->sum('yh_money'); $money6=D('Split')->where('uid='.$rows['uid'])->sum('yh_money'); $_total=$money1+$money2+$money3+$money4+$money5+$money6; ?>
                        <td><?php echo ($_total); ?></td>


                
                        <td>
                            
                            <?php if($one[status] == 0): ?><button class="zaixian_shou">关闭</button>
                                <?php else: ?>
                                <button class="zaixian_shou">开启</button><?php endif; ?> 

                        </td>


                        <td class="_frozen">
                            
                            <?php if($one[frozen] == 1): ?><button class="frozen">正常</button>
                                <?php else: ?>
                                <button class="frozen">冻结</button><?php endif; ?> 

                        </td>

                        
                        <td>

                            <?php if($rows['pid']>1){ $pa=D('Ptyh')->where('uid='.$rows['pid'])->find(); $uid=$pa['uid']; $name=$pa['name']; if(empty($name)){ $uid=0; $name="该上级未认证"; } }else if($rows['pid']==0||$rows['pid']==1){ $uid=0; $name="直属平台"; } ?>
                            <?php if($uid == 0): echo ($name); ?>
                                <?php else: ?>
                                <a href="<?php echo U('yh_view?uid='.$uid);?>">
                                    <?php echo ($name); ?>/<?php echo ($rows["level"]); ?>
                                </a><?php endif; ?>
                            
                        </td>
                        <td><?php echo ($rows['gather']['yongjin']+$rows['gather']['fenrun']); ?></td>
                        <td class="">
                                <button class="_tixian">提现</button>

                        </td>

                        <td class="">
                            <?php $isMashang = M('kbxx')->where('uid='.$rows['uid'])->count(); ?>
                            <?php if($isMashang == 1): ?><button class="unsetkbxx" data-id="<?php echo ($rows["uid"]); ?>">取消码商</button>

                            <?php else: ?>
                                <button class="setkbxx" data-id="<?php echo ($rows["uid"]); ?>">设置为码商</button><?php endif; ?>


                        </td>

                                                  
						<td>
							<a title="详细" href="<?php echo U('yh_view?uid='.$rows['uid']);?>">详细</a>
                            
						</td>
					</tr><?php endforeach; endif; else: echo "" ;endif; ?>
				<?php else: ?>
				<td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td><?php endif; ?>
			</tbody>
		</table>

	</div>

    <div class="page"  style="float:left;margin-right:300px;margin-top:32px;"><?php echo ($_page); ?></div>

        </div>
        <div class="cont-ft" style="margin-left: -20px;">
            <div class="copyright">
                <div class="fl">感谢使用<a href="#" >绿叶收银台</a>管理平台</div>
                <div class="fr">V<?php echo (ONETHINK_VERSION); ?></div>
            </div>
        </div>
    </div>
    <!-- /内容区 -->
    <script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "", //当前网站地址
            "APP"    : "/index.php", //当前项目地址
            "PUBLIC" : "/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    </script>
    <script type="text/javascript" src="/Public/static/think.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/common.js"></script>
    <script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();

            /* 左边菜单高亮 */
            url = window.location.pathname + window.location.search;
            url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
            $subnav.find("a[href='" + url + "']").parent().addClass("current");

            /* 左边菜单显示收起 */
            $("#subnav").on("click", "h3", function(){
                var $this = $(this);
                $this.find(".icon").toggleClass("icon-fold");
                $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
                      prev("h3").find("i").addClass("icon-fold").end().end().hide();
            });

            $("#subnav h3 a").click(function(e){e.stopPropagation()});

            /* 头部管理员菜单 */
            $(".user-bar").mouseenter(function(){
                var userMenu = $(this).children(".user-menu ");
                userMenu.removeClass("hidden");
                clearTimeout(userMenu.data("timeout"));
            }).mouseleave(function(){
                var userMenu = $(this).children(".user-menu");
                userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
                userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
            });

	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });

            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
    </script>

    
    <link href="/Public/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <link href="/Public/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/Public/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="/Public/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
    $(function(){

        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var type   = $("#sch-sort-txt_type").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += '&status=' + status + "&" + query;
            }
            if(type != ''){
                query += '&type=' + type + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });

            //回车搜索
    $(".search-input").keyup(function(e){
        if(e.keyCode === 13){
            $("#search").click();
            return false;
        }
    });


        Think.setValue("extend", <?php echo ((isset($info["extend"]) && ($info["extend"] !== ""))?($info["extend"]):0); ?>);
        //导航高亮
        highlight_subnav('<?php echo U('ptyh');?>');




        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down1").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
        $("#sub-sch-menu li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu").addClass("hidden");
            })
        });

        $(".search-form").find(".drop-down_type").hover(function(){
            $("#sub-sch-menu_type").removeClass("hidden");
        },function(){
            $("#sub-sch-menu_type").addClass("hidden");
        });

        $("#sub-sch-menu_type li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt_type").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu_type").addClass("hidden");
            })
        });
        $('#time-start').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

        $('#time-end').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });





        $('.zaixian_shou').click(function(){
            var current=$(this)
            var text=current.html();
            var _this=current.parent().parent().find('.uid');
            var uid =_this.text();
            if(text=='开启'){
              var  status=0;
            }else{
              var  status=1;
            }
            $.ajax({
                type:'post',
                data:{'status':status,'uid':uid,'type':'status'},
                url:"<?php echo U('ptyh');?>",
                success:function(m){
                    if(m==1){
                        // current.html('')
                        if(status==1){

                            current.html('开启')
                        }else{
                            current.html('关闭')
                        }
                        
                    }
                }

            })
        })



        // $('.path2_status').click(function(){
        //     var current=$(this)
        //     var text=current.text();
        //     var _this=current.parent().parent().find('.uid');
        //     var uid =_this.text();
        //     if(text=='开启'){
        //       var  status=0;
        //     }else{
        //       var  status=1;
        //     }
        //     $.ajax({
        //         type:'post',
        //         data:{'path2_status':status,'uid':uid,'type':'path2_status'},
        //         url:"<?php echo U('ptyh');?>",
        //         success:function(m){
        //             if(m==1){
        //                 current.text('')
        //                 if(status==1){
        //                     current.text('开启')
        //                 }else{
        //                     current.text('关闭')
        //                 }
                        
        //             }
        //         }

        //     })
        // })



        $('._tixian').click(function(){
            var current=$(this)
            var _this=current.parent().parent().find('.uid');
            var uid =_this.text();
            $.ajax({
                type:'post',
                data:{'uid':uid},
                url:"<?php echo U('tixian_by');?>",
                success:function(m){
                    alert(m)
                }

            })
        })

    })


</script>
<script type="text/javascript">
        $('._frozen').on('click','.frozen',function(){
        // $('.frozen').click(function(){
            var current=$(this)
            var text=current.html();

            var _this=current.parent().parent().find('.uid');
            var uid =_this.text();
            
            if(text=='正常'){
                var  status=0;
                var str=''
                str+='<input class="input" type="text" style="width:100%;height:30px;line-height:30px;" name="content" value="" placeholder="填写冻结原因">';
                current.parent().html(str);


               $('._frozen').on('blur','input',function(){
                    var frozen_val=$('._frozen input').val();
                    
                    $.ajax({
                        type:'post',
                        data:{'frozen':status,'uid':uid,'type':'frozen','frozen_val':frozen_val},
                        url:"<?php echo U('ptyh');?>",
                        success:function(m){
                          
                            if(m==1){
                                if(status==1){
                                    var btn='<button class="frozen">正常</button>';

                                    $('._frozen input').parent().html(btn);
                                }else{
                                    alert('冻结成功！')
                                    var btn='<button class="frozen">冻结</button>';
                                    // alert(btn)

                                    $('._frozen input').parent().html(btn);

                                }
                                
                            }
                        }

                    })

              });
              





            }else{
              var  status=1;
              $.ajax({
                type:'post',
                data:{'frozen':status,'uid':uid,'type':'frozen'},
                url:"<?php echo U('ptyh');?>",
                success:function(m){
                    if(m==1){
                        // current.html('')
                        if(status==1){

                            current.html('正常')
                        }else{
                            current.html('冻结')
                        }
                        
                    }
                }

            })
            }
            
        })

    $('.kg').click(function(){
        var obj = document.getElementsByClassName("ids");
        check_val = [];
        for(k in obj){
            if(obj[k].checked)
                check_val.push(obj[k].value);
        }
        var type=$('#sch-sort-txt_type').attr('data');
        var _this=$(this).text()
        if(_this=='开启'){
            var status=1;
        }else{
            var status=0;
        }
            $.ajax({
                type:'post',
                data:{'ids':check_val,'type':type,'status':status},
                url:"<?php echo U('ptyh');?>",
                success:function(m){
                    alert(m)
                        // alert("提交扣款人数："+ids+"，成功："+success+"，失败："+default+"。失败合同号："+ht+"对应失败原因："+error)
                }
            })
    })

    //添加用户
    $('.yh_add').click(function(){
        location.href = '<?php echo U("add_user");?>';
    });

    $('.yh_delete').click(function(){
        var obj = document.getElementsByClassName("ids");
        var check_val = [];
        for(k in obj){
            if(obj[k].checked)
                check_val.push(obj[k].value);
        }

        $.ajax({
            type:'post',
            data:{'uids':check_val},
            url:"<?php echo U('yh_delete');?>",
            success:function(m){
                // alert(m)
                if(m==0){
                    alert('请选择需要删除的用户！')
                }else if(m==1){
                    alert('删除成功！')
                    location.reload()
                }
            }
        })

        
    })

    /**
     * 设置用户为码商
     */
    $('.setkbxx').click(function(){
        var uid = $(this).data('id');
        var url = "<?php echo U('Alipay/ptyh');?>";

        $.post(url,{type:'setkbxx',uid:uid},function (ret) {
            // todo

            location.reload();
            
        },'json');

    });

    //取消用户码商
        $('.unsetkbxx').click(function(){
            var uid = $(this).data('id');
            var url = "<?php echo U('Alipay/ptyh');?>";

            $.post(url,{type:'unsetkbxx',uid:uid},function (ret) {
                // todo
                console.log(ret);
                location.reload();

            },'json');

        });

        //一建提现
        $('.all_tixian').click(function(){
            var url = "<?php echo U('Alipay/alltixian');?>";
            $.get(url,function (ret) {
                console.log(ret);
                layer.msg('一键提现成功');
            });
        });




</script>

</body>
</html>